package com.prs.crm.dao.cqunicom.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.prs.crm.dao.cqunicom.TicketerDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.cqunicom.Ticketer;

/**
 * @author  WangTing
 *
 * 创建时间：2011-3-7
 * 
 */
public class TicketerDaoImpl extends BaseDaoImpl<Ticketer> implements TicketerDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<Ticketer> getAllTicketer() {
		// TODO Auto-generated method stub
		Criteria criteria = this.getSession().createCriteria(Ticketer.class);
		return criteria.list();
	}

	@Override
	public Integer delTicketer() {
		return (Integer) this.getHibernateTemplate().execute(
			      new HibernateCallback() {   
						public Object doInHibernate(Session session) throws HibernateException {
							Query query = session.createQuery("delete from Ticketer");
							return query.executeUpdate();
				        }   
				 } );
	}
	
}
